#include "world.h"

World::World(unsigned int tiles_x, unsigned int tiles_y)
{
    ImageDirectory = "resources/img/";

    WaterImage.LoadFromFile(ImageDirectory + "water.jpg");
    GrassImage.LoadFromFile(ImageDirectory + "grass.jpg");
    
    WaterSprite.SetImage(WaterImage);
    GrassSprite.SetImage(GrassImage);
    
    Tiles.x = tiles_x;
    Tiles.y = tiles_y;
    
}

World::World(sf::Vector2i tiles)
{
    World(tiles.x, tiles.y);
}

void World::Draw(sf::RenderWindow& _app)
{
    for(unsigned int x=0 ; x<Tiles.x ; x++)
    {
	for(unsigned int y=0 ; y<Tiles.y ; y++)
	{
	    _app.Draw( GrassSprite );
	    
	    GrassSprite.SetPosition( (x*GrassSprite.GetSize().x) + x + 1, (y*GrassSprite.GetSize().y) + y + 1 );
	}
    }
    
    GrassSprite.SetPosition(0.f, 0.f);
}

